const { defineConfig } = require('@vue/cli-service')
const Mock=require("mockjs")
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,

  devServer: {
    onAfterSetupMiddleware: function (devServer) {
      if (!devServer) {
        throw new Error('webpack-dev-server is not defined');
      }

    devServer.app.get('/list', function (req, res) {
        let data=Mock.mock({
          "data|10":[{
            id:"@id",
            title:"@ctitle(3,5)",
            "children|7":[
              {
                name:"@ctitle(4,7)",
                "price|20-30":0,
                img:"@image(70x70,@color)"
              }
            ]
          }]
        })
        res.json(data.data)
    });
  },
  }
})
